package com.zzzzzz.account.service;

import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.transaction.annotation.Transactional;

import com.zzzzzz.account.model.PortraitForm;
import com.zzzzzz.account.model.User;
import com.zzzzzz.core.exception.SystemException;
import com.zzzzzz.core.exception.ZzzzzzException;

public interface UserService {

	/**
	 * 登录验证入口
	 * @param email
	 * @param password
	 * @param rememberMe
	 * @throws ZzzzzzException
	 * @throws SystemException
	 */
	void login(String email, String password, boolean rememberMe) throws ZzzzzzException, SystemException;
	
	@Transactional
	void addAndSendAccountActivationEmail(User user, HttpServletRequest request);

	void add(User user);

	void sendAccountActivationEmail(String userId, HttpServletRequest request) throws ZzzzzzException;

	void sendAccountActivationEmail(User user, HttpServletRequest request);

	void sendResetPasswordEmail(String email, HttpServletRequest request) throws ZzzzzzException;

	void resetPassword(String userId, String newPassword, String reNewPassword) throws ZzzzzzException;

	User findById(String id) throws ZzzzzzException;

	Boolean isSignedIn();

	User findCurrentUser() throws ZzzzzzException;

	String findCurrentUserId();

	User findByEmail(String email) throws ZzzzzzException;

	User activate(String userId) throws SystemException, ZzzzzzException;

	void editStatus(String userId, Integer status);

	void editProfileBasic(User user);

	void editAccountGeneral(User user, String givenPassword) throws ZzzzzzException;

	void editPassword(User user, String givenPassword, String newPassword, String reNewPassword) throws ZzzzzzException;
	
	void editPortrait(PortraitForm userPortraitForm) throws ZzzzzzException, IOException;

	void removePortrait() throws ZzzzzzException;

	String findPortraitIdByUserId() throws ZzzzzzException;

	String findThumbnailIdByUserId() throws ZzzzzzException;

	Boolean isEmailExisting(String email);

	List<User> findAll(int start, int offset, boolean ascending);
}
